import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: xsicrz
 * Date: 6/6/11
 * Time: 8:18 AM
 * To change this template use File | Settings | File Templates.
 */
public class DateUtils {

      public static List<CustomDate> getMonths() {
        List<CustomDate> months = new ArrayList<CustomDate>();
        int[] monthsInt =   {Calendar.JANUARY, Calendar.FEBRUARY, Calendar.MARCH,Calendar.APRIL,Calendar.MAY,Calendar.JUNE,Calendar.JULY,Calendar.AUGUST,Calendar.SEPTEMBER,Calendar.OCTOBER,Calendar.NOVEMBER,Calendar.DECEMBER};

       Calendar beginOfMonth = Calendar.getInstance();
        for(int aMonth : monthsInt) {
            beginOfMonth.set(Calendar.DAY_OF_MONTH, 1);
            beginOfMonth.set(Calendar.MONTH, aMonth);
            beginOfMonth.set(Calendar.YEAR, 2000);
            beginOfMonth.set(Calendar.HOUR_OF_DAY, 0);
            beginOfMonth.set(Calendar.MINUTE, 0);
            beginOfMonth.set(Calendar.SECOND, 0);
            beginOfMonth.set(Calendar.MILLISECOND, 0);
            months.add(new CustomDate(beginOfMonth.getTime()));
        }
        return months;
    }

    public static class CustomDate {
        Date date;

        public CustomDate(Date date) {
            this.date = date;
        }

        public String toString() {
            return new SimpleDateFormat("MMM").format(date);
        }

        public int getMonth(){
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            return cal.get(Calendar.MONTH);
        }
    }
}
